<template>
  <view>
    <navigation back title="填写备注" />

    <view class="page-container">
      <view class="container">
        <view class="title">请填写您的备注</view>
        <u--textarea
          class="textarea"
          count
          maxlength="200"
          height="160"
          placeholder="请输入……"
          v-model="inputVal"
        />
        <view class="btn flex flex-middle flex-center" @click="submit">
          确认
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  data() {
    return {
      inputVal: "",
    };
  },
  computed: {
    ...mapGetters(["notes"]),
  },
  onLoad() {
    this.inputVal = this.notes;
  },
  methods: {
    submit() {
      this.$store.commit("SET_NOTES", this.inputVal);
      this.$navigateBack();
    },
  },
};
</script>

<style scoped lang="scss">
.title {
  color: #2c2c2c;
  font-size: 16px;
  font-weight: bold;
}

.btn {
  width: 248px;
  height: 42px;
  background: #31bc4e;
  border-radius: 21px;
  margin: 24px auto 0;
  color: #fff;
  font-weight: bold;
}

.textarea {
  margin-top: 12px;
  font-size: 12px;
}

.container {
  padding: 24px 16px;
}
</style>